var platformJson=
{
	"1":"ios",
	"2":"android",
	"3":"all"
};
var jgPush= {
	 
	dataCache:null,
	
	startEvent:function(){
		 
	},
	bindEventOtherBtn:function(){
		$('.addData').unbind();
		$('#send').on('click',function(){
			
			var msg=$.trim($("#msg").val());
			if(msg==""){
				alert("请输入推送内容");
				return;
			}
			
			//var alias="";
			var platFormRadio = $('#platformRadios input[name="platForm"]:checked ').val();
			var platForm=platformJson[platFormRadio];			
			var tags=$("#tags").val();
			var registIds="";
			var phone=$.trim($("#phone").val());

			//var url=$("#contextPath").val()+'/common/jgPushCtr/sendMsg?msg='+msg+'&platForm='+platForm+'&aliases='+alias+'&tags='+tags+'&registIds='+registIds+'&phone='+phone;
			var url=$("#contextPath").val()+'/common/jgPushCtr/sendMsg?msg='+msg+'&platForm='+platForm+'&tags='+tags+'&registIds='+registIds+'&phone='+phone;
			$.ajax({
			url:url,
			type:"get",
			dataType : "JSON",
			success:function(){
				alert("推送成功!");
				art.dialog.close();
				returnStatus=true;		
			},
			error:function(){alert("推送异常!");}
			});
			
			return false;
			
			
			
			
			
			
//			var url = 'common/jgPushCtr/sendMsg';
//			var params = jsUtils.serializeJson($('.com-addForm'));
//			var cb = function(data){
//				alert(data.msg);
//				//成功返回
//				if(data.resultCode==200){
//					//关闭窗口并刷新数据
//					art.dialog.close();
//					returnStatus=true;
//				}
//			};
//			
//			sendApiNoLoadSync(url, params, cb, 'GET');
//			return false;
		});
	},
		
	init : function() {
		jsUtils.controlFunctionBtn();
		jgPush.bindEventOtherBtn();
	}
};

$(document).ready(function() {
	jgPush.init();
	window.parent.setLiAbled();
});

//提供给外部刷新调用
function refashData(){
	jgPush.setPageChange(null);
	jgPush.search();
}


